package com.capgemini.remind.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;

import java.io.Serializable;
import java.util.Date;

/**
 * Created by annson on 2016/7/4.
 */
public class Remind implements Serializable {

    private String dealerNum;

    private String memberName;
    private String mobilePhone;
    private String customerId;
    private String customerGroupId;

    private String wechatMember;

    private String carPlate;
    private String carBrand;
    private String carModel;
    private String carId;

    private String maintenanceItem;
    private String serviceRemindId;


    private String lastPartBrand;
    private String lastPartName;
    private String lastMaintenanceStore;//最后服务门店
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date lastMaintenanceDate;//最后服务日期
    private String lastMaintenanceMileage;//最后服务里程


    private Long countOfToStore;//一年累计进店次数
    private Long countOfToStoreParam;//一年累计进店次数
    private Long countOfToStoreMin;//一年累计进店次数
    private Long countOfToStoreMax;//一年累计进店次数

    private Long moneyOfYear;//一年累计消费金额
    private Long moneyOfYearMin;//一年累计消费金额
    private Long moneyOfYearMax;//一年累计消费金额

    private Long countOfSMS;//保养提醒发送次数

    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date lastRemindDate;//最后提醒日期


    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date nextCalcDate;
    private String nextCalcDateParam;
    private String nextCalcMileage;

    private String remindStatus;


    private String lastCarcheckStore;
    private Date lastCarcheckDate;
    private String lastCarcheckMileage;
    private Date lastCalcDate;
    private String nextCalcBasis;
    private String maintenanceSpecBasis;
    private String lastMaintenanceItem;
    private String lastMaintenanceItemDisplay;


    public String getDealerNum() {
        return dealerNum;
    }

    public void setDealerNum(String dealerNum) {
        this.dealerNum = dealerNum;
    }

    public String getMemberName() {
        return memberName;
    }

    public void setMemberName(String memberName) {
        this.memberName = memberName;
    }

    public String getMobilePhone() {
        return mobilePhone;
    }

    public void setMobilePhone(String mobilePhone) {
        this.mobilePhone = mobilePhone;
    }

    public String getCustomerId() {
        return customerId;
    }

    public void setCustomerId(String customerId) {
        this.customerId = customerId;
    }

    public String getCarPlate() {
        return carPlate;
    }

    public void setCarPlate(String carPlate) {
        this.carPlate = carPlate;
    }

    public String getCarModel() {
        return carModel;
    }

    public void setCarModel(String carModel) {
        this.carModel = carModel;
    }

    public String getCarId() {
        return carId;
    }

    public void setCarId(String carId) {
        this.carId = carId;
    }

    public String getMaintenanceItem() {
        return maintenanceItem;
    }

    public void setMaintenanceItem(String maintenanceItem) {
        this.maintenanceItem = maintenanceItem;
    }

    public String getServiceRemindId() {
        return serviceRemindId;
    }

    public void setServiceRemindId(String serviceRemindId) {
        this.serviceRemindId = serviceRemindId;
    }

    public String getLastPartBrand() {
        return lastPartBrand;
    }

    public void setLastPartBrand(String lastPartBrand) {
        this.lastPartBrand = lastPartBrand;
    }

    public String getLastPartName() {
        return lastPartName;
    }

    public void setLastPartName(String lastPartName) {
        this.lastPartName = lastPartName;
    }

    public String getLastMaintenanceStore() {
        return lastMaintenanceStore;
    }

    public void setLastMaintenanceStore(String lastMaintenanceStore) {
        this.lastMaintenanceStore = lastMaintenanceStore;
    }

    public Date getLastMaintenanceDate() {
        return lastMaintenanceDate;
    }

    public void setLastMaintenanceDate(Date lastMaintenanceDate) {
        this.lastMaintenanceDate = lastMaintenanceDate;
    }

    public String getLastMaintenanceMileage() {
        return lastMaintenanceMileage;
    }

    public void setLastMaintenanceMileage(String lastMaintenanceMileage) {
        this.lastMaintenanceMileage = lastMaintenanceMileage;
    }

    public Long getCountOfToStore() {
        return countOfToStore;
    }

    public void setCountOfToStore(Long countOfToStore) {
        this.countOfToStore = countOfToStore;
    }

    public Long getMoneyOfYear() {
        return moneyOfYear;
    }

    public void setMoneyOfYear(Long moneyOfYear) {
        this.moneyOfYear = moneyOfYear;
    }

    public Date getLastRemindDate() {
        return lastRemindDate;
    }

    public void setLastRemindDate(Date lastRemindDate) {
        this.lastRemindDate = lastRemindDate;
    }

    public Date getNextCalcDate() {
        return nextCalcDate;
    }

    public void setNextCalcDate(Date nextCalcDate) {
        this.nextCalcDate = nextCalcDate;
    }

    public String getNextCalcMileage() {
        return nextCalcMileage;
    }

    public void setNextCalcMileage(String nextCalcMileage) {
        this.nextCalcMileage = nextCalcMileage;
    }

    public String getNextCalcDateParam() {
        if(nextCalcDate != null && nextCalcDateParam == null){
            nextCalcDateParam = DateFormatUtils.format(nextCalcDate, "yyyy-MM");
        }
        return nextCalcDateParam;
    }

    public void setNextCalcDateParam(String nextCalcDateParam) {
        this.nextCalcDateParam = nextCalcDateParam;
    }

    public String getCarBrand() {
        return carBrand;
    }

    public void setCarBrand(String carBrand) {
        this.carBrand = carBrand;
    }

    public String getCustomerGroupId() {
        return customerGroupId;
    }

    public void setCustomerGroupId(String customerGroupId) {
        this.customerGroupId = customerGroupId;
    }

    public Long getCountOfToStoreMin() {
        return countOfToStoreMin;
    }

    public void setCountOfToStoreMin(Long countOfToStoreMin) {
        this.countOfToStoreMin = countOfToStoreMin;
    }

    public Long getCountOfToStoreMax() {
        return countOfToStoreMax;
    }

    public void setCountOfToStoreMax(Long countOfToStoreMax) {
        this.countOfToStoreMax = countOfToStoreMax;
    }

    public Long getMoneyOfYearMin() {
        return moneyOfYearMin;
    }

    public void setMoneyOfYearMin(Long moneyOfYearMin) {
        this.moneyOfYearMin = moneyOfYearMin;
    }

    public Long getMoneyOfYearMax() {
        return moneyOfYearMax;
    }

    public void setMoneyOfYearMax(Long moneyOfYearMax) {
        this.moneyOfYearMax = moneyOfYearMax;
    }

    public Long getCountOfToStoreParam() {
        return countOfToStoreParam;
    }

    public void setCountOfToStoreParam(Long countOfToStoreParam) {
        if(countOfToStoreParam != null){
            if(countOfToStoreParam == 1){
                setCountOfToStoreMax(5L);
            }else if(countOfToStoreParam == 2){
                setCountOfToStoreMin(5L);
                setCountOfToStoreMax(10L);
            }else if(countOfToStoreParam == 3){
                setCountOfToStoreMin(10L);
                setCountOfToStoreMax(15L);
            }else if(countOfToStoreParam == 4){
                setCountOfToStoreMin(15L);
            }
        }
        this.countOfToStoreParam = countOfToStoreParam;
    }

    public String getRemindStatus() {
        return remindStatus;
    }

    public void setRemindStatus(String remindStatus) {
        this.remindStatus = remindStatus;
    }

    public String getLastCarcheckStore() {
        return lastCarcheckStore;
    }

    public void setLastCarcheckStore(String lastCarcheckStore) {
        this.lastCarcheckStore = lastCarcheckStore;
    }

    public Date getLastCarcheckDate() {
        return lastCarcheckDate;
    }

    public void setLastCarcheckDate(Date lastCarcheckDate) {
        this.lastCarcheckDate = lastCarcheckDate;
    }

    public String getLastCarcheckMileage() {
        return lastCarcheckMileage;
    }

    public void setLastCarcheckMileage(String lastCarcheckMileage) {
        this.lastCarcheckMileage = lastCarcheckMileage;
    }

    public Date getLastCalcDate() {
        return lastCalcDate;
    }

    public void setLastCalcDate(Date lastCalcDate) {
        this.lastCalcDate = lastCalcDate;
    }

    public String getNextCalcBasis() {
        return nextCalcBasis;
    }

    public void setNextCalcBasis(String nextCalcBasis) {
        this.nextCalcBasis = nextCalcBasis;
    }

    public String getMaintenanceSpecBasis() {
        return maintenanceSpecBasis;
    }

    public void setMaintenanceSpecBasis(String maintenanceSpecBasis) {
        this.maintenanceSpecBasis = maintenanceSpecBasis;
    }

    public String getLastMaintenanceItem() {
        return lastMaintenanceItem;
    }

    public void setLastMaintenanceItem(String lastMaintenanceItem) {
        this.lastMaintenanceItem = lastMaintenanceItem;
    }

    public Long getCountOfSMS() {
        return countOfSMS;
    }

    public void setCountOfSMS(Long countOfSMS) {
        this.countOfSMS = countOfSMS;
    }

    public String getWechatMember() {
        return wechatMember;
    }

    public void setWechatMember(String wechatMember) {
        this.wechatMember = wechatMember;
    }


    public String getLastMaintenanceItemDisplay() {
        if(StringUtils.isNotBlank(lastMaintenanceItem) && StringUtils.length(lastMaintenanceItem) > 20){
            lastMaintenanceItemDisplay = StringUtils.substring(lastMaintenanceItem, 0 , 20) + "...";
        }else{
            lastMaintenanceItemDisplay = lastMaintenanceItem;
        }
        return lastMaintenanceItemDisplay;
    }

    public void setLastMaintenanceItemDisplay(String lastMaintenanceItemDisplay) {
        this.lastMaintenanceItemDisplay = lastMaintenanceItemDisplay;
    }

}
